#ifndef PCMSPEC_H
#define PCMSPEC_H

extern "C" {

    #include <libavformat/avformat.h>
}

class PCMSpec
{
private:
    int _sampleRate;
    int _channelLayout;
    AVSampleFormat _format;

    int _perChannelSize;
    // 一帧音频的大小 ，如果是立体声包括左右声道
    int _frameSize;
    // 声道数
    int _numChannel;
    // 每秒采集的音频大小
    int _perSecondSize;

public:
    PCMSpec();
    PCMSpec(int sample, int channelLayout, AVSampleFormat format);

    void calFrameSize();

    int getSampleRate() const;
    int getChannelLayout() const;
    AVSampleFormat getSampleFormat() const;
    int getFrameSize();
    int getNumChannel();
    int getPerChannelSize();

    void setSampleRate(int sampleRate);
    void setChannelLayout(int channelLayout);
    void setSampleFormat(AVSampleFormat format);
};

#endif // PCMSPEC_H
